home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: phcoms4.seri.philips.nl!newssvr!news
- From: niessene <niessene@natlab.research.philips.com>
- Subject: Mouse Event Handler
- Sender: news@natlab.research.philips.com (USENET News System)
- Message-ID: <316B59B1.359D@natlab.research.philips.com>
- Date: Wed, 10 Apr 1996 06:48:17 GMT
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- Mime-Version: 1.0
- X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/735)
- Organization: Philips Research Laboratories
-
- Can somebody tell me why the following programm doesn't work?
- It only goes one time in the ISR. I'm using Borland C++ 4.5.
-
- #include <stdio.h>
- #include <dos.h>
- #include <conio.h>
-
- void interrupt far nieuwint33() {
- sound(1500);
- delay(10);
- nosound(); }
-
- void main() {
- union REGS reg;
- struct SREGS sreg;
- int oldmask;
- void * oldhandler;
-
- // reset mouse
- reg.x.ax=0;
- int86(0x33, ®, ®);
-
- // swap event handler
- reg.x.ax=20;
- reg.x.cx=1;
- sreg.es=FP_SEG(nieuwint33);
- reg.x.dx=FP_OFF(nieuwint33);
- int86x(0x33, ®, ®, &sreg);
- oldmask=reg.x.cx;
- oldhandler=MK_FP(sreg.es, reg.x.dx);
-
- clrscr();
- do {}
- while (!kbhit());
-
- // swapevent handler
- reg.x.ax=20;
- reg.x.cx=oldmask;
- sreg.es=FP_SEG(oldhandler);
- reg.x.dx=FP_OFF(oldhandler);
- int86x(0x33, ®, ®, &sreg);
- }
-